﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WF_QLThuVien.DataLayer;
using WF_QLThuVien.Entities;
using System.Collections;

namespace WF_QLThuVien.BusinessLayer
{
    public class CDocGiaBLL
    {
        CDocGiaDAL dalDocGia;

        public ArrayList loadDocGiaTB()
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                return dalDocGia.loadDocGia();
            }
            catch (System.Exception ex)
            {
                throw new Exception("Lỗi loadDocGiaTB - CDocGiaBLL");
            }
        }

        public ArrayList loadOnlyDocGia(string maDocGia)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                return dalDocGia.loadOnlyMaDocGia(maDocGia);
            }
            catch (System.Exception ex)
            {
                throw new Exception("Lỗi Tìm Không Thấy Đọc Giả - CDocGiaBLL");
            }
        }

        public ArrayList loadOnlySinhVien(string maSinhVien)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                return dalDocGia.loadOnlyMaSinhVien(maSinhVien);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        public ArrayList loadOnlySoDTSV(string soDT)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                return dalDocGia.loadOnlySoDTSV(soDT);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        public bool themDocGiaBLL(CDocGia dg)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                if (dalDocGia.themDocGia(dg))
                {
                    return true;
                }
                else
                {
                    return false;
                }

            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        public bool xoaDocGiaBLL(CDocGia dg)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                if (dalDocGia.xoaDocGia(dg))
                {
                    return true;
                }
                else
                {
                    return false;
                }

            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        public bool xoaDocGiaBLL2(string maDocGia)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                if (dalDocGia.xoaDocGia(maDocGia))
                {
                    return true;
                }
                else
                {
                    return false;
                }

            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        public bool suaDocGiaBLL(CDocGia dg)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                if (dalDocGia.suaDocGia(dg))
                {
                    return true;
                }
                else
                {
                    return false;
                }

            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        public CDocGia timMaDocGia(string maDocGia)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                return dalDocGia.timMaDocGia(maDocGia);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        public CDocGia timMaSinhVien(string maSinhVien)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                return dalDocGia.timMaSinhVien(maSinhVien);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        public CDocGia timSoDTSV(string soDT)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                return dalDocGia.timSoDTSV(soDT);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        #region: Wolfag
        public bool KtMaSinhVien(string maSinhVien)
        {
            try
            {
                dalDocGia = new CDocGiaDAL();
                return dalDocGia.CheckMaSinhVien(maSinhVien);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
        #endregion
    }
}
